package StudyCode.summary.regularexpressionsmatch;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeterminingIfStringMatchesPatternExactly {
	public static void main(String[] argv) {
		String patternStr = "b";
		Pattern pattern = Pattern.compile(patternStr);

		CharSequence inputStr = "a b c";
		Matcher matcher = pattern.matcher(inputStr);
		boolean matchFound = matcher.matches(); // false
		System.out.println("是否完全匹配" + matchFound);
		matcher.reset("b");
		matchFound = matcher.matches(); // true
		System.out.println("是否完全匹配" + matchFound);
		matchFound = matcher.lookingAt(); // false
		System.out.println("是否完全匹配" + matchFound);
	}
}
